<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller{

    function __construct(){
        parent::__construct();
    }

    public function index(){

    }

    public function process(){
        // Load the model
        $this->load->model('user_model');
        // Validate the user can login
        $result = $this->user_model->validate();
        // Now we verify the result
        if(! $result){
            // If user did not validate, then show them login page again , followed by an error
            $this->session->set_flashdata('error', 'Λάθος συνδυασμός ονόματος χρήστη/κωδικού πρόσβασής. Προσπαθήστε ξανά!');
            redirect('login');
        }else{
            // If user did validate,
            redirect('home');
        }
    }
}
?>